/*
 * Filename : CombatantNode.java
 * Description : **COMPLETE**
 * History  : Date               Engineer       Description
 *            ---------          ------------   --------------------------------
 *            September 17, 2007      waitek         Initial creation.
 */

package com.lct.eq2.data;

import java.util.Comparator;
import javax.swing.tree.DefaultMutableTreeNode;

public class CombatantNode implements Comparator {
    DefaultMutableTreeNode node = null;
    String name = null;
    
    public CombatantNode() {
    }
    
    /** Creates a new instance of CombatantNode */
    public CombatantNode(DefaultMutableTreeNode node, String name) {
        this.name = name;
        this.node = node;
    }
     //+ " - [" + this.getEncounterDuration().getDuration() + "]"
    public DefaultMutableTreeNode getNode() {
        return this.node;
    }
    
    public String getName() {
        return this.name;
    }

    public int compare(Object o1, Object o2) {
        CombatantNode c1 = (CombatantNode)o1;
        CombatantNode c2 = (CombatantNode)o2;
        int rval = 0;
        if (c1.getName().compareToIgnoreCase(c2.getName()) > 0) {
            rval = 1;
        } else if (c1.getName().compareToIgnoreCase(c2.getName()) < 0) {
            rval = -1;
        } else {
            rval = 0;
        }
        return rval;
    }
    
}
